package com.anotacion;

import com.forclass.Message;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class SelfAnnoMain {
    public static void main(String[] args) throws NoSuchMethodException {
        System.out.println("********获取Message类上注解的信息**********");
        Class<?> msg1 = Message1.class;
        for (Annotation an:msg1.getAnnotations()) {
            System.out.println(an);
        }

        System.out.println("********获取Message1类上的echo方法上的注解信息**********");
        Class<?> clazz1 = Message1.class;
        Method method =  clazz1.getDeclaredMethod("echo", String.class);
        for (Annotation an:method.getAnnotations()) {
            System.out.println(an);
        }
    }
}
